<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="manage/manage_layout">

<head>
    <title>在线用户管理</title>
</head>

<body class="manage">

<div layout:fragment="content">
    <div class="container-fluid">
        <table class="w100">
            <thead>
            <tr>
                <th>会话ID</th>
                <th>登录用户ID</th>
                <th>登录用户名称</th>
                <th>登录IP</th>
                <th>登录地址</th>
                <th>登录时间</th>
                <th>最后操作时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="online:${onlines}">
                <td th:text="${online.id}"></td>
                <td th:text="${online.userId}"></td>
                <td th:text="${online.userName}"></td>
                <td th:text="${online.ip}"></td>
                <td th:text="${online.ipAddress}"></td>
                <td th:text="${online.startTime}"></td>
                <td th:text="${online.lastAccessTime}"></td>
                <td><a href='javascript:;' class='btn btn-xs text-danger'
                       th:onclick="'javascript:offline(\''+${online.userId}+'\',\''+${online.userName}+'\')'"><span
                        class='glyphicon glyphicon-remove'></span> 强制下线</a></td>
            </tr>
            </tbody>
        </table>
    </div>

    <script th:replace="common/common_libs::commonjs"></script>
    <script>
        $('table').bootstrapTable({
            striped: true,
        });

        function offline(userId, userName) {
            BootstrapDialog.show({
                title: '强制下线提示',
                message: '请再次确认是否强制下线用户【' + userName + '】',
                type: BootstrapDialog.TYPE_DANGER,
                buttons: [{
                    label: '确定',
                    cssClass: 'btn-danger',
                    action: function (dialog) {

                    }
                }, {
                    label: '取消',
                    action: function (dialog) {
                        dialog.close();
                    }
                }]
            });
        }
    </script>
</div>

</body>
</html>